package cn.iocoder.yudao.module.scrm.dal.mysql.refund;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.scrm.dal.dataobject.refund.RefundDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.scrm.controller.admin.refund.vo.*;

/**
 * 退款 Mapper
 *
 * @author admin
 */
@Mapper
public interface RefundMapper extends BaseMapperX<RefundDO> {

    default PageResult<RefundDO> selectPage(RefundPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RefundDO>()
                .likeIfPresent(RefundDO::getNo, reqVO.getNo())
                .eqIfPresent(RefundDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(RefundDO::getCustomerId, reqVO.getCustomerId())
                .eqIfPresent(RefundDO::getContractId, reqVO.getContractId())
                .inIfPresent(RefundDO::getOwnerUserId, reqVO.getOwnerUserId())
//                .betweenIfPresent(RefundDO::getReturnTime, reqVO.getReturnTime())
                .likeIfPresent(RefundDO::getAccountName, reqVO.getAccountName())
                .eqIfPresent(RefundDO::getCardNumber, reqVO.getCardNumber())
                .likeIfPresent(RefundDO::getBankName, reqVO.getBankName())
                .eqIfPresent(RefundDO::getPrice, reqVO.getPrice())
                .eqIfPresent(RefundDO::getAttachment, reqVO.getAttachment())
                .eqIfPresent(RefundDO::getProcessInstanceId, reqVO.getProcessInstanceId())
                .eqIfPresent(RefundDO::getAuditStatus, reqVO.getAuditStatus())
                .eqIfPresent(RefundDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(RefundDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RefundDO::getId));
    }

}